package com.example.sqlitelearning.Mapper;

import com.example.sqlitelearning.Model.User;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

// UserMapper.java
@Mapper  // 声明为 MyBatis Mapper
public interface UserMapper {
    // 根据用户名查找用户
    @Select("SELECT * FROM users WHERE username = #{username}")
    User findByUsername(String username);

    // 插入用户
    @Insert("INSERT INTO users (username, password) VALUES (#{username}, #{password})")
    void insertUser(User user);
}
